from typing import List
import itertools

class Solution:
    def minPowerTime(self, strength: List[int], k: int) -> int:
        """
        枚举所有顺序，模拟每种顺序的最少分钟数，取最优
        """
        n = len(strength)
        min_time = float('inf')
        for order in itertools.permutations(strength):
            x = 1
            t = 0
            for s in order:
                # 剑能量每分钟加x，求最小dt使 x*dt >= s
                dt = (s + x - 1) // x
                t += dt
                x += k
            min_time = min(min_time, t)
        return min_time
